package com.gali.juc;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Auther: gali
 * @Date: 2022-08-23 14:49
 * @Description:
 */
public class CASDemo {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        System.out.println(atomicInteger.compareAndSet(5, 2022)+"\t"+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 2022)+"\t"+atomicInteger.get());

    }
}
